<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* html, body {
	width: 100%;
	height: 100%;
}
   
div {
	background-color: white;
	height: 100%;
	width: 100%;
}
* {
	margin: 0;
	padding: 0;
} */
body {
        background-color: aqua;
    }

    </style>
</head>
<body>
    <div style="top:  0; right: 0; left: 0 ;bottom: 0;">
        <button id="btn">开关灯</button>
    </div>
    <script>
        let flag = false;
        const div = document.querySelector('body');
        // console.log(div);   
        const btn  = document.querySelector('#btn');
         btn.onclick = function(){
            if(flag){
                div.style.backgroundColor = 'white';
            }else{
                div.style.backgroundColor = 'black';
            }
            flag = !flag;
        }
    </script>
</body>
</html>